import { createApp } from 'vue'
import App from './App.vue'
import { globalRegister } from './global'
//全局导入
// import ElementPlus from 'element-plus'
// import 'element-plus/dist/index.css'

//测试axios
// import './service/axios_demo'

//项目导入css重置，做一些初始化的动作
import 'normalize.css'
import './assets/css/index.less'

import router from './router'

import store from './store'

import { setupStore } from './store'

// import jgRequest from './service'

const app = createApp(App)

// globalRegister(app)
app.use(globalRegister)
app.use(store)
setupStore()
//如果把setupStore()放在app.use(router)下面  刷新时，app.use(router)执行--》insall(){}函数--》获取当前path ---》router.routes--->notfound -->setupStore()==>注册动态路由routes==》路由守卫（回调）==》router.getRoute()
app.use(router)

// app.use(ElementPlus)
app.mount('#app')

// console.log(process.env.VUE_APP_BASE_URL)

// jgRequest.request({
//   url: '/users/list',
//   method: 'get'
// })

// interface DataType {
//   data: any
//   returnCode: string
//   success: boolean
// }
// jgRequest
//   .get<DataType>({
//     url: '/home/multidata',
//     method: 'get',
//     interceptors: {
//       requestInterceptor: (config) => {
//         console.log('单独的请求成功的拦截')
//         return config
//       },
//       responseInterceptor: (res) => {
//         console.log('单独的响应成功的拦截')
//         return res
//       }
//     }
//   })
//   .then((res) => {
//     // console.log(JSON.stringify(res))
//     console.log(res.success)
//     console.log(res.returnCode)
//     console.log(JSON.stringify(res.data))
//   })
